#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const long long mod = 1e9+7;
long long quick(long long x,long long pw)
{
	long long X = 1;
	long long T = x%mod;
	while(pw!=0)
	{
		if(pw&1) 
		{
			X = (X*T)%mod;
		}
		pw>>=1;
		T = (T*T)%mod;
	}
	return X;
}
int main()
{
	long long n;
	scanf("%lld",&n);
    long long ans = 1;
    for(long long i = 1;i<=n;i++)
    {
    	ans = (ans*i)%mod;
	}
	long long ansx = quick(2,n-1);
	ans = ((ans-ansx)%mod+mod)%mod;
	printf("%lld\n",ans); 
}
